using System;
using System.Collections.ObjectModel;
using System.Text;

namespace Newtonsoft.Json
{
	public class JavaScriptConstructor
	{
		private string _name;

		private JavaScriptParameters _parameters;

		public string Name
		{
			get
			{
				return this._name;
			}
		}

		public JavaScriptParameters Parameters
		{
			get
			{
				return this._parameters;
			}
		}

		public JavaScriptConstructor(string name, JavaScriptParameters parameters)
		{
			if (name == null)
			{
				throw new ArgumentNullException("name");
			}
			if (name.Length == 0)
			{
				throw new ArgumentException("Constructor name cannot be empty.", "name");
			}
			this._name = name;
			this._parameters = parameters ?? JavaScriptParameters.Empty;
		}

		public override string ToString()
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append("new ");
			stringBuilder.Append(this._name);
			stringBuilder.Append("(");
			if (this._parameters != null)
			{
				for (int i = 0; i < this._parameters.Count; i++)
				{
					stringBuilder.Append(this._parameters[i]);
				}
			}
			stringBuilder.Append(")");
			return stringBuilder.ToString();
		}
	}
}